package cn.com.huzo.repository.oa.impl;

import cn.com.huzo.model.entities.oa.ToDoEntity;
import cn.com.huzo.repository.oa.ToDoRepository;
import huzofw.repository.impl.GenericRepositoryImpl;
import huzofw.repository.impl.MyBatisDaoUtils;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository;

/**
 * 待办事项数据访问对象
 *
 * @author 吴旭
 */
@Repository("ToDoRepository")
public class ToDoRepositoryImpl extends GenericRepositoryImpl<ToDoEntity, String>
        implements ToDoRepository {

    private final String namespace = "cn.com.huzo.repository.oa.ToDoRepository";

    /**
     * 构造函数,设置the instance to ToDoRepositoryImpl.class.
     */
    public ToDoRepositoryImpl() {
        super(ToDoEntity.class);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer fetchForCount(Map<String, Object> criterion) {
        return getSqlSession().selectOne(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchForCount"), criterion);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<ToDoEntity> fetchForPage(Map<String, Object> criterion) {
        return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchForPage"), criterion);
    }
}
